package net.suncapper.wcss.web.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.suncapper.wcss.common.utls.SessionUtils;
import net.suncapper.wcss.model.domain.UserManage;
import net.suncapper.wcss.model.domain.WhitelistSetting;
import net.suncapper.wcss.model.dto.PageDTO;
import net.suncapper.wcss.model.vo.ApplicationVO;
import net.suncapper.wcss.service.IUserManageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.suncapper.wcss.common.JsonResponse;
import net.suncapper.wcss.service.IApplicationService;
import net.suncapper.wcss.model.domain.Application;


/**
 *
 *  前端控制器
 *
 *
 * @author ztr
 * @since 2025-11-11
 * @version v1.0
 */
@RestController
@RequestMapping("/api/application")
public class ApplicationController {

    private final Logger logger = LoggerFactory.getLogger( ApplicationController.class );

    @Autowired
    private IApplicationService applicationService;
    @Autowired
    private IUserManageService userManageService;
    @PostMapping("submit")
    public JsonResponse submit(@RequestBody Application application)
    {
        return applicationService.submit(application);
    }
    @GetMapping("list")
    public JsonResponse List(ApplicationVO application, PageDTO pageDTO)
    {
        WhitelistSetting currentLoginUser = SessionUtils.getCurrentLoginUser();
        Page<ApplicationVO> list=applicationService.getlist(application,pageDTO,currentLoginUser);
        return JsonResponse.success(list);

    }
    @PostMapping("auodit")
    public JsonResponse auodit(@RequestBody ApplicationVO application)
    {

       return  applicationService.updateByIds(application);
    }

}

